﻿@{
    ViewBag.Title = "signup";
}

<h2>signup</h2>

<form action="../Account/validateSignup" method="post" enctype="multipart/form-data">

    <table border="1">
        <tr><td>
            
            <table>

                <tr>
                    <td>
                        Enter Username:
                    </td>

                    <td>
                        <input type="text" name="username" id="username" placeholder="Enter UserName" required />
                        <input type="button" name="check" id="check" value="Check Availability" />
                    </td>

                    <td>
                        <div id="result"></div>
                    </td>

                </tr>

                <tr>
                    <td>
                        Enter First Name:
                    </td>

                    <td>
                        <input type="text" name="fname" id="fname" placeholder="Enter First Name" required />
                    </td>
                </tr>

                <tr>
                    <td>
                        Enter Last Name:
                    </td>

                    <td>
                        <input type="text" name="lname" id="lname" placeholder="Enter Last Name" required />
                    </td>
                </tr>

                <tr>
                    <td>
                        Enter E-mail Address:
                    </td>

                    <td>
                        <input type="email" name="email" id="email" placeholder="Enter Email Address" required />
                    </td>
                </tr>


                <tr>
                    <td>
                        Enter Password:
                    </td>

                    <td>
                        <input type="password" name="pwd" id="pwd" placeholder="Enter Password" required />
                    </td>
                </tr>


                <tr>
                    <td>
                        Confirm Password:
                    </td>

                    <td>
                        <input type="password" name="cpwd" placeholder="Re-Enter Password" required />
                    </td>
                </tr>

                <tr>
                    <td>
                        Secret Question
                    </td>

                    <td>

                        <select name="question" id="question">
                            <option value="select1">Select one&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
                            <option value="uncle">What is the First Name of your Favourite uncle?</option>
                            <option value="pet">What is the Name of Your Pet?</option>
                            <option value="place">What is Your Favourite Place?</option>
                            <option value="book">What is Name of Your Favourite Book?</option>
                            <option value="cousin">What is Your Oldest Cousin Name?</option>
                            <option value="teacher">What is Name of Your Favourite Teacher?</option>
                            <option value="Food">What was Your Favourite Food as a Child?</option>
                            <option value="holiday">Where You Spend Your Child Hood Holidays?</option>
                            <option value="author">Who is Your Favourite Author?</option>
                            <option value="honeymoon">Where did You Spend Your Honeymoon?</option>
                            <option value="boss">What is the Last Name of your First Boss?</option>
                            <option value="musician">What is Name of Your Favourite Musician?</option>
                            <option value="aunt">What is the First Name of your Favourite aunt? &nbsp;</option>
                            <option value="sports">What is the Name of Your Favourite Sports?</option>
                        </select>
                    </td>
                </tr>


                <tr>
                    <td>
                        answer
                    </td>

                    <td>
                        <input type="text" name="answer" size="45" />
                    </td>

                </tr>


                <tr>
                    <td>
                        Select Profile Picture:
                    </td>

                    <td>
                        <input type="file" name="path" id="path" />
                    </td>
                </tr>


                <tr>
                    <td></td>

                    <td>
                        <input type="submit" name="signup" id="signup" value="Register" />
                    </td>
                </tr>
        </table>
            </td></tr>
    </table>

</form>




<script>

    $(document).ready(function () {
        
        $('#check').click(function () {

            var username = $('#username').val();

            $.getJSON("Availability?u=" + username, function (data) {

                if (data == true) {

                    $('#result').text("User already exists in database");
                                
                    $('#username').val("");
                }
                else {

                    $('#result').text("User Name is available");
                }
            });

        });


    });
</script>